<template>
  <div class="checkin_info_summary">
    <table style="table-layout: fixed;width: 100%;border-collapse: collapse;">
      <thead>
        <tr>
          <th>
            <div>入离时间</div>
          </th>
          <th>房价</th>
          <th>押金</th>
          <th>收款</th>
          <th>消费</th>
          <th>预授权</th>
          <th>备注</th>
          <th style="width: 100px; border-bottom-right-radius: 4px;
            border-bottom-left-radius: 4px;
            background: #f24e4c;
            color: #fff;
            border-radius: 0;">余额</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
            <div v-if="info.peopleEntity.state != 4">
              <span class="in_block">{{ info.peopleEntity.newArrivalsTime }}</span>
              -
              <span class="in_block">{{ info.peopleEntity.newPredissociationTime }}</span>
            </div>
            <div v-else>
              -/- - -/-
            </div>
          </td>
          <td>
            <div v-if="info.peopleEntity.state != 4">￥ {{ priceMap[today] ? priceMap[today] : currData }}</div>
            <div v-else>--</div>
          </td>
          <td class="cursor">

            <template v-if="info.peopleEntity.state == 0 || info.peopleEntity.state == 1 || info.peopleEntity.state == 2">
              <el-popover placement="top-start" width="200" trigger="hover" :disabled="yjlist.length==0">
                <div style="padding: 12px;border-radius: 4px; border: 1px solid #ddd;">
                  <span style="display: block; margin-bottom: 5px; " v-for="item in yjlist" :key="item.id">{{item.pname}}:
                    &nbsp;{{item.pay_price}}
                  </span>
                </div>
                <el-tag style="font-size: 14px;" slot="reference">￥ {{ info.peopleEntity.deposit }}</el-tag>
              </el-popover>
            </template>
            <template v-else-if="info.peopleEntity.state == 3">
              <el-tag style="font-size: 14px;" slot="reference">￥ 0</el-tag>
            </template>

          </td>
          <td class="cursor">

            <template v-if="info.peopleEntity.state == 0 || info.peopleEntity.state == 1 || info.peopleEntity.state == 2">
              <el-popover placement="top-start" width="200" trigger="hover" :disabled="sklist.length==0">
                <div style="padding: 12px;border-radius: 4px; border: 1px solid #ddd;">
                  <span style="display: block; margin-bottom: 5px; " v-for="item in sklist" :key="item.id">{{item.pname}}:
                    &nbsp;{{item.pay_price}}
                  </span>
                </div>
                <el-tag style="font-size: 14px;" slot="reference">￥ {{ info.peopleEntity.payment }}</el-tag>
              </el-popover>
            </template>
            <template v-else-if="info.peopleEntity.state == 3">
              <el-tag style="font-size: 14px;" slot="reference">￥ 0</el-tag>
            </template>


          </td>
          <td class="cursor">
            <div v-if="info.peopleEntity.state == 0 || info.peopleEntity.state == 1 || info.peopleEntity.state == 2">￥ {{ info.peopleEntity.consumption }}</div>
            <div v-else-if="info.peopleEntity.state == 3">￥ 0</div>
          </td>
          <td>
            <div class="blue_color1 cursor" v-if="info.peopleEntity.state == 0 ||info.peopleEntity.state == 1 || info.peopleEntity.state == 2" @click="yushouqlistComBtn" style="cursor: pointer;">￥ {{ info.peopleEntity.xinyongCardMoney }}</div>
            <div class="blue_color1 cursor" v-else-if="info.peopleEntity.state == 3" style="cursor: pointer;">￥ 0</div>
          </td>
          <td class="cursor">
            <div class="remark_ellipsis" style="padding: 0px 20px;">{{ info.singleEntity.remarks ? info.singleEntity.remarks : '无' }}</div>
          </td>
          <td style="width: 100px; border-bottom-right-radius: 4px;
            border-bottom-left-radius: 4px;
            background: #f24e4c;
            color: #fff;">
            <div v-if="info.peopleEntity.state == 0 || info.peopleEntity.state == 1 || info.peopleEntity.state == 2">￥ {{ (info.peopleEntity.payment + info.peopleEntity.deposit + info.peopleEntity.xinyongCardMoney - info.peopleEntity.consumption).toFixed(2) }}</div>
            <div v-else-if="info.peopleEntity.state == 3">￥ 0</div>
          </td>
        </tr>
      </tbody>
    </table>

    <el-divider style="margin: 20px 0;margin-bottom: 0;"></el-divider>

    <!-- 按钮组 -->
    <div style="line-height: 60px;">
      <div style="">
        <!--    <el-dropdown split-button type="primary" @command="handleCommand" trigger="click">
          制新卡
          <el-dropdown-menu slot="dropdown" >
            <el-dropdown-item  comment="1" >复制卡</el-dropdown-item>
            <el-dropdown-item comment="2" >注销卡</el-dropdown-item>
            <el-dropdown-item>门卡记录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown> -->
        <el-dropdown split-button @command="handleCommand" @click="DoorNewCard" trigger="click">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-card"></i>制新卡
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="1">复制卡</el-dropdown-item>
            <el-dropdown-item command="2">注销卡</el-dropdown-item>
            <el-dropdown-item command="3">门卡记录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
        <el-button @click="ruzhangHandle(info.peopleEntity)" v-if="isAuth('hotel:thotelfloorroomcheckinaccounting:save1') && (info.peopleEntity.state == 1 || info.peopleEntity.state == 2 || info.peopleEntity.state == 4)">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-card"></i>入账</el-button>
        <el-button @click="jztf(info.floorRoomEntity,info.peopleEntity,'0');" v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:thotelfloorroomcheckinaccounting:united_house')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-yicijiezhang"></i>结账退房</el-button>
        <el-button @click="jztf2(info.floorRoomEntity,info.peopleEntity,'1');" v-if="info.peopleEntity.state == 1 && isAuth('hotel:thotelfloorroomcheckinaccounting:not_jie_etix')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-qunfengweijiesuan"></i>未结退房</el-button>
        <el-button v-if="info.peopleEntity.state == 1 && isAuth('hotel:thotelfloorroomcheckinpeople:xuzhu')" @click="xuzhuTiqian(info.peopleEntity)">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-xuqi"></i>续住/提前</el-button>

        <el-button v-if="info.peopleEntity.state == 1 && isAuth('hotel:thotelfloorroomcheckinpeople:save1')" @click="addPeopleBtn(info.peopleEntity)">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-tongzhuren"></i>添加同住</el-button>

        <el-button v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:thotelfloorroomcheckinsingle:join_united_house')" @click="joinRoomBtn(info.peopleEntity.singleId)">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-lianhe"></i>合并联房</el-button>

        <el-button v-if="(info.peopleEntity.state == 1 && info.floorRoomEntity.singleNo != 0) && isAuth('hotel:thotelfloorroomcheckinsingle:exit_single')" @click="etixRoom(info.peopleEntity.floorRoomId)">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-tuichu"></i>退出联房</el-button>

        <el-button @click="chexiao(info.peopleEntity)" v-if="(info.peopleEntity.state == 0 || info.peopleEntity.state == 3) && isAuth('hotel:thotelfloorroomcheckinaccounting:chexiao_jiezhang')">撤销结账</el-button>

        <el-button @click="chexiaoNotJieZhang(info.peopleEntity.id)" v-if="info.peopleEntity.state == 2 && isAuth('hotel:thotelfloorroomcheckinaccounting:chexiao_jiezhang')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-chexiao"></i>撤销结账</el-button>

        <el-button @click="chongzhangHandle()" v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:thotelfloorroomcheckinaccounting:cz')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-iconset0187"></i>冲账</el-button>

        <el-button @click="showwpzj=true" v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:trentalgoods:save')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-aixinsanzujie"></i>物品租借</el-button>

        <el-button @click="showkhly=true" v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:tcustomermessage:save')">
          <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-icon-test"></i>客人留言</el-button>

        <el-button v-if="isAuth('hotel:thotelfloorroomcheckinpeopleinvoice:save')" @click="invoiceShow()"> <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-fapiao"></i>发票</el-button>
        <el-button @click="printPreview()"> <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-print"></i>打印</el-button>
        <el-button @click="addLianFangBtn()" v-if="(info.peopleEntity.state == 1 || info.peopleEntity.state == 2) && isAuth('hotel:thotelfloorroomcheckinsingle:addLianfang')"> <i style="font-size: 14px;margin-right: 4px;" class="iconfont icon-print"></i>添加联房</el-button>
        <!-- <el-button>锁定订单</el-button> -->
      </div>
    </div>

    <ruzhang :note="this.printconfig.note" :infoSet="this.info" :priceMap="this.priceMap" :currData="this.currData"
      v-if="ruzhangVisible" ref="ruzhang" @refreshDataList="getInfo()"></ruzhang>
    <closingRoom v-if="closingRoomVisible" ref="closingRoom" @refreClosing="unRoom" @refrePrintJieZhang="printJieZhang"
      @refreshDataList="getInfo()"></closingRoom>
    <addPeople v-if="addPeopleVisible" ref="addPeople" @refreClosing="unRoom" @refreshDataList="getInfo()"></addPeople>
    <xuzhuTiqian v-if="xuzhuTiqianVisible" ref="xuzhuTiqian" @refreClosing="unRoom" @refreshDataList="getInfo()"></xuzhuTiqian>
    <joinRoom v-if="joinRoomVisible" ref="joinRoom" @refreClosing="unRoom" @refreshDataList="getInfo()"></joinRoom>

    <t1 v-show="false" id="t1" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData"></t1>
    <t2 v-show="false" id="t2" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData"></t2>
    <t3 v-show="false" id="t3" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData"></t3>
    <t4 v-show="false" id="t4" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData" ref="t4"></t4>
    <t5 v-show="false" id="t5" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData" ref="t5"></t5>
    <t6 v-show="false" id="t6" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData"
      :finance-data="this.financeData" ref="t6"></t6>

    <invoice v-if="invoiceVisable" ref="invoice" :info="this.info"></invoice>
    <chongzhang v-if="chongzhangVisible" ref="chongzhang" @refreshDataList="getInfo()"></chongzhang>
    <addLianFang v-if="addLianFangVisible" ref="addLianFang" @refreshDataList="getInfo()"></addLianFang>

    <el-dialog title="门卡记录" :visible.sync="showdetailsVisible" v-if="showdetailsVisible">
      <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50">
        </el-table-column>
        <el-table-column prop="operation" header-align="aa" align="aa" label="制卡类型">
        </el-table-column>
        <el-table-column prop="floorName" header-align="center" align="center" label="楼栋">
        </el-table-column>
        <el-table-column prop="floorCengName" header-align="center" align="center" label="楼层">
        </el-table-column>


        <el-table-column prop="roomNum" header-align="center" align="center" label="房号">
        </el-table-column>


        <el-table-column prop="skTime" header-align="center" align="center" label="开始时间">
        </el-table-column>
        <el-table-column prop="endTime" header-align="aa" align="aa" label="到期时间">
        </el-table-column>
        <el-table-column prop="username" header-align="center" align="center" label="操作人">
        </el-table-column>
        <el-table-column prop="creatTime" header-align="aa" align="aa" label="操作时间">
        </el-table-column>

        <!-- <el-table-column
              fixed="right"
              header-align="center"
              align="center"
              width="150"
              label="操作">
              <template slot-scope="scope">
                <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
                <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
              </template>
            </el-table-column> -->
      </el-table>
      <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper">
      </el-pagination>
    </el-dialog>
    <el-dialog width="70%" title="物品租借" :visible.sync="showwpzj" v-if="showwpzj">
      <trentalgoods :foomFloorId="foomFloorId" :pricePId="pricePId"></trentalgoods>
    </el-dialog>
    <el-dialog width="70%" title="客人留言" :visible.sync="showkhly" v-if="showkhly">
      <tcustomermessage :foomFloorId="foomFloorId" :pricePId="pricePId"></tcustomermessage>
    </el-dialog>


    <!-- 设置超时房费 -->
    <el-dialog :close-on-click-modal="false" width="40%" :close-on-press-escape="false" title="设置超时房费" :visible.sync="settingPrice"
      append-to-body>
      <el-form label-width="120px">
        <el-form-item v-for="(item,index) in overtimeList" :label="item.roomSignNum">
          <el-radio-group style="margin-left: 16px;" v-model="item.type" size="small">
            <el-radio-button :label="0">加收半天房费</el-radio-button>
            <el-radio-button :label="1">自定义</el-radio-button>
          </el-radio-group>
          <el-input-number style="margin-left: 16px;" v-show="item.type == 1" size="small" v-model="item.price"
            :precision="2" :step="10" :min="0"></el-input-number>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="overTimeSubmit">确认</el-button>
          <el-button @click="settingPrice = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

  </div>
</template>

<script>
  import $ from "jquery";
  import moment from 'moment';
  import ruzhang from './ruzhang';
  import closingRoom from './closingRoom';
  import joinRoom from './reserve/join/index';
  // import joinRoom from './joinRoom';
  import addPeople from './addPeople';
  import xuzhuTiqian from './xuzhuTiqian';
  import trentalgoods from '../trentalgoods/trentalgoods.vue';
  import addLianFang from './common/addLianFang.vue';
  import tcustomermessage from '../tcustomermessage/tcustomermessage.vue';
  import t1 from '../../../common/printtemplate/dengji_58mm';
  import t2 from '../../../common/printtemplate/dengji_80mm';
  import t3 from '../../../common/printtemplate/dengji_A5';
  import t4 from '../../../common/printtemplate/jiezhang_58mm';
  import t5 from '../../../common/printtemplate/jiezhang_80mm';
  import t6 from '../../../common/printtemplate/jiezhang_A5';
  import {
    getLodop
  } from '../../../../utils/lodop';
  import invoice from './invoice';
  import chongzhang from './chongzhang'
  export default {
    props: ['type', 'financeData', 'peopleId', 'currState', 'roomId'],
    data() {
      return {
        yjlist: [],
        sklist: [],
        selectNotJie: {},
        showkhly: false,
        addLianFangVisible: false,
        settingPrice: false,
        showdetailsVisible: false,
        showwpzj: false,
        foomFloorId: '',
        pricePId: '',
        dataForm: {
          skTime: '',
          zkUser: '',
          roomNum: '',
          kaNo: '',
          creatUserId: '',
          endTime: '',
          ckSfz: '',
          operation: '',
          creatTime: '',
          floorCengId: '',
          floorId: ''
        },
        doorLockParams: {
          RoomNumber: "",
          StartDate: "",
          EndDate: "",
          OpeartorType: "",
          CardID: "",
          skr: "",
          sfz: "",
          CardNum: ""
        },
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        currData: '',
        ruzhangVisible: false,
        joinRoomVisible: false,
        closingRoomVisible: false,
        addPeopleVisible: false,
        xuzhuTiqianVisible: false,
        popInfo: {},
        today: moment().format('YYYY-MM-DD'),
        priceMap: {},
        priceDateList: [],
        overtimeList: [],
        info: {
          peopleEntity: {},
          singleEntity: {},
          floorRoomEntity: {},
          roomEntity: {}
        },
        istrues: 0,
        printconfig: {}, //打印配置
        printconfig2: {}, //打印配置2
        invoiceVisable: false,
        chongzhangVisible: false,
        overtimeFlag: false,
        CZSum: 0
      };
    },
    components: {
      ruzhang,
      closingRoom,
      addPeople,
      xuzhuTiqian,
      joinRoom,
      t1,
      t2,
      t3,
      t4,
      t5,
      t6,
      invoice,
      chongzhang,
      trentalgoods,
      addLianFang,
      tcustomermessage
    },
    methods: {
      addLianFangBtn(){
        this.addLianFangVisible = true;
        this.$nextTick(() => {
          this.$refs.addLianFang.init(this.info.peopleEntity.singleId);
        });
      },
      print(printFlag) {
        console.log(printFlag);
        if (printFlag == 1) {
          console.log('打印执行方法');
          setTimeout(() => {
            this.$nextTick(() => {
              this.printPreview();
            });
          }, 500);
        }
      },
      printJieZhang(printFlag, singleId) {
        console.log(printFlag);
        if (printFlag == 1) {
          //查询结账订单金额
          console.log('请求账单');
          console.log(singleId);
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/single_jiezhang_water/${singleId}`),
            method: 'get',
            params: this.$http.adornParams()
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              console.log(data.data)
              this.$refs.t4.initFinanceData(data.data);
              this.$refs.t5.initFinanceData(data.data);
              this.$refs.t6.initFinanceData(data.data);
              this.$refs.t4.initMemberLevelDetailEntity(data.memberLevelDetailEntity);
              this.$refs.t5.initMemberLevelDetailEntity(data.memberLevelDetailEntity);
              this.$refs.t6.initMemberLevelDetailEntity(data.memberLevelDetailEntity);
              this.$nextTick(() => {
                const _that = this
                setTimeout(() => {
                  _that.printPreview2();
                }, 500);
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        }
      },
      overTimeSubmit() {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/united_setting_price`),
          method: 'post',
          data: this.$http.adornData({
            overtimeList: JSON.stringify(this.overtimeList),
            overtimeFlag: this.overtimeFlag ? 1 : 2,
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.settingPrice = false
            this.next3(this.selectNotJie)
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      toAccounting(item, type) {
        //将数据存储到本地
        var p = {
          singleId: item.singleId,
          type: type
        };
        this.$cookie.set('accounting', JSON.stringify(p));
      },
      yushouqlistComBtn() {
        console.log(1);
        this.$emit('refreYuShouListFinanceBtn');
      },
      etixRoom(floorRoomId) {
        this.$confirm('您确认要退出联房吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/exit_single/${floorRoomId}`),
            method: 'get',
            params: this.$http.adornParams()
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              this.toAccounting({
                singleId: data.data.id
              }, '1');
              this.$nextTick(() => {
                this.init(this.popInfo);
                this.$emit('refreClosing');
              });
              this.$message({
                message: this.$t('Common.OperationSuccessful'),
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.$emit('refreClosing');
                }
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      },
      jztf(item, peopleEntity, i) {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/getCheckReturnGoods`),
          method: 'get',
          params: this.$http.adornParams({
            id: peopleEntity.singleId
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            if (data.page > 0) {
              this.$confirm('您还有' + data.page + '件物品未归还，是否跳转物品租借页面?', '提示', {
                confirmButtonText: '是',
                cancelButtonText: '否',
                type: 'warning'
              }).then(() => {
                this.showwpzj = true;
              }).catch(() => {

              });
            } else {
              if (i == '0') {
                this.jieZhangTuiFang(peopleEntity);
              } else {
                this.notJieEtixBtn(item, peopleEntity.singleId)
              }
            }
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      jztf2(item, peopleEntity, i) {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/checkReturnGoods_people/${peopleEntity.id}`),
          method: 'get',
          params: this.$http.adornParams({})
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            if (data.page > 0) {
              this.$confirm('您还有' + data.page + '件物品未归还，是否跳转物品租借页面?', '提示', {
                confirmButtonText: '是',
                cancelButtonText: '否',
                type: 'warning'
              }).then(() => {
                this.showwpzj = true;
              }).catch(() => {

              });
            } else {
              if (i == '0') {
                this.jieZhangTuiFang(peopleEntity);
              } else {
                this.notJieEtixBtn(item, peopleEntity.singleId)
              }
            }
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      notJieEtixBtn(item, singleId) {
        this.selectNotJie = item;
        //新版
        console.log(item);
        if (item.singleMain == 1 && item.singleNo != 0) {
          this.$alert('有联房还未结账，主房不可未结退房', {
            confirmButtonText: '确定'
          });
        } else {
          //检测是否超时
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/timeout/${item.id}`),
            method: 'get',
            params: this.$http.adornParams({
              singleId: singleId
            })
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              if (data.data.overtime) {
                this.overtimeList.push({
                  mainPeopleId: data.data.mainPeopleId,
                  floorRoomId: data.data.id,
                  roomSignNum: data.data.roomSignNum,
                  overtime: data.data.overtime,
                  todayRoomPrice: data.data.todayRoomPrice,
                  type: 0,
                  price: 0
                })
                this.peintOvertime();
              } else {
                this.next3(item)
              }
            } else {
              this.$message.error(data.msg);
            }
          });
        }
      },
      //弹框，告知要加收房费
      peintOvertime() {
        this.$confirm('选中房间已经超过中午退房时间是否加收房费?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.overtimeFlag = true;
          this.settingPrice = true;
        }).catch(() => {
          this.overtimeFlag = false
          this.next3(this.selectNotJie);
        })
      },
      next3(item) {
        if (item.singleMain == 0 && item.singleNo != 0) {
          this.$confirm('此房间是联房，未结离店会取消与其他房间的联房，是否继续操作？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/not_jie_etix/${item.id}`),
              method: 'get',
              params: this.$http.adornParams({
                type: 1
              })
            }).then(({
              data
            }) => {
              if (data && data.code === 0) {
                this.$nextTick(() => {
                  this.$emit('refreClosing');
                  this.$emit('refreshDataList');
                  this.init(this.popInfo);
                });
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          });
        } else {
          this.$confirm('您确认要未结退房吗?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/not_jie_etix/${item.id}`),
              method: 'get',
              params: this.$http.adornParams({
                type: 2
              })
            }).then(({
              data
            }) => {
              if (data && data.code === 0) {
                this.$nextTick(() => {
                  this.$emit('refreClosing');
                  this.$emit('refreshDataList');
                  this.init(this.popInfo);
                });
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          });
        }
      },
      chexiao(pop) {
        console.log(pop);
        this.$confirm('您确认要撤销结账吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$prompt('原因', '撤销未结退房', {
              confirmButtonText: '恢复房态',
              cancelButtonText: '不恢复房态',
              inputErrorMessage: '原因不能为空'
            })
            .then(({
              value
            }) => {
              console.log(value);
              this.$http({
                url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_jiezhang/${pop.id}`),
                method: 'get',
                params: this.$http.adornParams({
                  type: 1
                })
              }).then(({
                data
              }) => {
                if (data && data.code === 0) {
                  this.$nextTick(() => {
                    this.$emit('refreClosing');
                    this.$emit('refreshDataList');
                    this.init(this.popInfo);
                  });
                  this.$message({
                    message: this.$t('Common.OperationSuccessful'),
                    type: 'success',
                    duration: 1500,
                    onClose: () => {}
                  });
                } else {
                  this.$message.error(data.msg);
                }
              });
            })
            .catch(({
              value
            }) => {
              console.log(value);
              this.$http({
                url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_jiezhang/${pop.id}`),
                method: 'get',
                params: this.$http.adornParams({
                  type: 2
                })
              }).then(({
                data
              }) => {
                if (data && data.code === 0) {
                  this.$nextTick(() => {
                    this.$emit('refreClosing');
                    this.$emit('refreshDataList');
                    this.init(this.popInfo);
                  });
                  this.$message({
                    message: this.$t('Common.OperationSuccessful'),
                    type: 'success',
                    duration: 1500,
                    onClose: () => {}
                  });
                } else {
                  this.$message.error(data.msg);
                }
              });
            });
        });
      },
      chexiaoNotJieZhang(id) {
        console.log(id);
        this.$confirm('您确认要撤销未结退房吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$prompt('原因', '撤销未结退房', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            inputErrorMessage: '原因不能为空'
          }).then(({
            value
          }) => {
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_jiezhang/${id}`),
              method: 'get',
              params: this.$http.adornParams({
                type: 1
              })
            }).then(({
              data
            }) => {
              if (data && data.code === 0) {
                this.$nextTick(() => {
                  this.$emit('refreClosing');
                  this.$emit('refreshDataList');
                  this.init(this.popInfo);
                });
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          });
        });
      },
      unRoom() {
        this.$emit('refreClosing');
      },
      jieZhangTuiFang(item) {
        this.closingRoomVisible = true;
        this.$nextTick(() => {
          this.$refs.closingRoom.init(item);
        });
      },
      // 入账
      ruzhangHandle(item) {
        this.ruzhangVisible = true;
        this.$nextTick(() => {
          this.$refs.ruzhang.init(item);
        });
      },
      // 加入联房
      joinRoomBtn(singleId) {
        this.joinRoomVisible = true;
        this.$nextTick(() => {
          this.$refs.joinRoom.init(singleId);
        });
      },
      init(pop) {
        this.popInfo = pop;
        this.getInfo();
        this.getPrintMsg();
        this.$nextTick(() => {});
      },
      xuzhuTiqian(item) {

        this.xuzhuTiqianVisible = true;
        this.$nextTick(() => {
          this.$refs.xuzhuTiqian.init({ ...item,
            roomId: this.info.roomEntity.id,
            roomSignNum:this.info.floorRoomEntity.roomSignNum,
            pename:this.info.peopleEntity.name,
            indexlength:0
          });
        });
      },
      getInfo() {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/pop_single/${this.popInfo.id}`),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.info.peopleEntity = data.data.peopleEntity;
            if (data.data.peopleEntity.state != 4) {
              this.priceMap = data.data.priceMap;
              this.priceDateList = data.data.priceDateList;
              this.currData = this.priceMap[moment(this.info.peopleEntity.arrivalsTime).format('YYYY-MM-DD')];
              this.info.peopleEntity = {
                ...this.info.peopleEntity,
                newArrivalsTime: moment(this.info.peopleEntity.arrivalsTime).format('MM/DD HH:mm'),
                newPredissociationTime: moment(this.info.peopleEntity.predissociationTime).format('MM/DD HH:mm')
              };
              console.log(this.info.peopleEntity);

              this.info.floorRoomEntity = data.data.floorRoomEntity;
              this.info.roomEntity = data.data.roomEntity;
            }
            this.foomFloorId = data.data.floorRoomEntity.id;
            this.pricePId = data.data.peopleEntity.id;
            this.info.singleEntity = data.data.singleEntity;
            this.yjlist = data.data.yjlist;
            this.sklist = data.data.sklist;

            this.getCZSum(); //获取
          }
        });
      },
      addPeopleBtn(item) {
        this.addPeopleVisible = true;
        this.$nextTick(() => {
          this.$refs.addPeople.init(item);
        });
      },
      getPrintMsg() {
        var url = '';
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelprinttemplate/info/9`),
          method: 'get'
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.printconfig = data.tHotelPrintTemplate;
          }
        });

        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelprinttemplate/info/2`),
          method: 'get'
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.printconfig2 = data.tHotelPrintTemplate;
          }
        });
      },
      printPreview() {
        if (!getLodop()) {
          this.$alert(
            `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
            '安装', {
              confirmButtonText: '确定',
              dangerouslyUseHTMLString: true
            }
          );
          return;
        } else {
          if (this.type == '2') {
            this.$refs.t4.initFinanceData(this.financeData);
            this.$refs.t5.initFinanceData(this.financeData);
            this.$refs.t6.initFinanceData(this.financeData);
          }

          this.$forceUpdate()
          this.$nextTick(()=>{
            this.CreateOneFormPage();
          })

          // if (s == 0) {
          //   LODOP.PRINT() //直接打印
          // }
          // if (s == 1) {
          //   LODOP.PREVIEW() //打印预览
          // }
          // if (s == 2) {
          //   LODOP.PRINT_SETUP() //打印维护
          // }
          // if (s == 3) {
          //   LODOP.PRINT_DESIGN() //打印设计
          // }

          // this.$nextTick(() => {
          //   console.log("4B44F795076C8F14211A5ED0A5339305DAB")
          //   LODOP.SET_LICENSES("", "4B44F795076C8F14211A5ED0A5339305DAB", "23580B189D96F33252722697A57AC00506B", "");
          //   LODOP.SET_PRINT_COPIES(this.printconfig.printSum);
          //   console.log(LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint));
          //   if (this.printconfig.preview) {
          //     if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
          //       LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
          //       LODOP.PRINT();
          //       // LODOP.PRINT_DESIGN();
          //     } else {
          //       LODOP.SET_PRINTER_INDEXA(0);
          //       LODOP.PRINT();
          //       // LODOP.PRINT_DESIGN();
          //     }
          //   } else {
          //     if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
          //       LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
          //       LODOP.PREVIEW();
          //       // LODOP.PRINT_DESIGN();
          //     } else {
          //       LODOP.SET_PRINTER_INDEXA(0);
          //       LODOP.PREVIEW();
          //       // LODOP.PRINT_DESIGN();
          //     }
          //   }
          // });
        }


      },
      printPreview2() {
        console.log("printPreview2",this.$refs.t5.$refs.t5.innerHTML)

        const LODOP = getLodop();
        if (!LODOP) {
          this.$alert(
            `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
            '安装', {
              confirmButtonText: '确定',
              dangerouslyUseHTMLString: true
            }
          );
          return;
        }

        //样式
        var strStyleCSS = " <link href='https://ebooking.qlan99.com/css/print.css' type='text/css' rel='stylesheet'> ";

        var olstyle1 = '<!DOCTYPE html><html lang="zh-CN"><head>' + strStyleCSS + '</head>' + ' <style> ' +
          'div{border:0!important}' + '</style>';
        var body = '';
        if (this.printconfig2.specs === '58mm') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig2.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t4.$refs.t4.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
        }
        if (this.printconfig2.specs === '80mm') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig2.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t5.$refs.t5.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
        }
        if (this.printconfig2.specs === 'A5') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig2.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t6.$refs.t6.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
        }
        body += '</html>';

        LODOP.ADD_PRINT_HTM(0, this.printconfig2.printPaperOffset, 1000, 2000, body); //增加超文本项

        LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '100%'); //设置缩放
        // LODOP.PRINT_INIT('订单') //打印初始化
        LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
        LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
        LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
        LODOP.SET_PRINT_COPIES(this.printconfig2.printSum);

        LODOP.SET_LICENSES("", "4B44F795076C8F14211A5ED0A5339305DAB", "23580B189D96F33252722697A57AC00506B",
          "");

        if (this.printconfig2.preview) {
          console.log("this.printconfig.defaultPrint",this.printconfig2.defaultPrint)
          console.log("LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)",LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint))
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint);
            LODOP.PRINT();
            // LODOP.PRINT_DESIGN();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            LODOP.PRINT();
            // LODOP.PRINT_DESIGN();
          }
        } else {
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint);
            LODOP.PREVIEW();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            LODOP.PREVIEW();
            // LODOP.PRINT_DESIGN();
          }
        }
      },
      CreateOneFormPage() {
        LODOP = getLodop();
        if (!LODOP) {
          this.$alert(
            `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
            '安装', {
              confirmButtonText: '确定',
              dangerouslyUseHTMLString: true
            }
          );
          return;
        }
        //样式
        var strStyleCSS = " <link href='https://ebooking.qlan99.com/css/print.css' type='text/css' rel='stylesheet'> ";

        var olstyle1 = '<!DOCTYPE html><html lang="zh-CN"><head>' + strStyleCSS + '</head>' + ' <style> ' +
          'div{border:0!important}' + '</style>';
        var body = '';
        if (this.type == '1') {
          if (this.printconfig.specs === '58mm') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig.printContentOffset)) +
              'mm  !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + document.getElementById('t1').innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
          }
          if (this.printconfig.specs === '80mm') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig.printContentOffset)) +
              'mm !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + document.getElementById('t2').innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
          }
          if (this.printconfig.specs === 'A5') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig.printContentOffset)) +
              'mm !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + document.getElementById('t3').innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
          }
        }
        if (this.type == '2') {

          if (this.printconfig2.specs === '58mm') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig2.printContentOffset)) +
              'mm !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + this.$refs.t4.$refs.t4.innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
          }
          if (this.printconfig2.specs === '80mm') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig2.printContentOffset)) +
              'mm !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + this.$refs.t5.$refs.t5.innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
          }
          if (this.printconfig2.specs === 'A5') {
            var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig2.printContentOffset)) +
              'mm !important}</style>';
            body = olstyle1 + olstyle2 + '<body>' + this.$refs.t6.$refs.t6.innerHTML + '</body>';
            LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
          }
        }

        if (this.type == '1') {
          body += '</html>';
          LODOP.ADD_PRINT_HTM(0, this.printconfig.printPaperOffset, 1000, 2000, body); //增加超文本项
          // LODOP.PRINT_INITA(this.printconfig.printContentOffset, this.printconfig.printPaperOffset) //打印初始化、设定纸张整体偏移量、设定可视编辑区域大小

          LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '100%'); //设置缩放
          // LODOP.PRINT_INIT('订单') //打印初始化
          LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
          LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
          LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
          // LODOP.SET_PRINT_STYLEA(0, "Horient", 2);
          LODOP.SET_PRINT_COPIES(this.printconfig.printSum); //设置打印次数

          console.log("4B44F795076C8F14211A5ED0A5339305DAB")
          LODOP.SET_LICENSES("", "4B44F795076C8F14211A5ED0A5339305DAB", "23580B189D96F33252722697A57AC00506B", "");
          LODOP.SET_PRINT_COPIES(this.printconfig.printSum);
          console.log(LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint));
          if (this.printconfig.preview) {
            if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
              LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
              LODOP.PRINT();
              // LODOP.PRINT_DESIGN();
            } else {
              LODOP.SET_PRINTER_INDEXA(0);
              LODOP.PRINT();
              // LODOP.PRINT_DESIGN();
            }
          } else {
            if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
              LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
              LODOP.PREVIEW();
              // LODOP.PRINT_DESIGN();
            } else {
              LODOP.SET_PRINTER_INDEXA(0);
              LODOP.PREVIEW();
              // LODOP.PRINT_DESIGN();
            }
          }
        }
        if (this.type == '2') {
          body += '</html>';
          LODOP.ADD_PRINT_HTM(0, this.printconfig2.printPaperOffset, 1000, 2000, body); //增加超文本项
          // LODOP.PRINT_INITA(this.printconfig.printContentOffset, this.printconfig.printPaperOffset) //打印初始化、设定纸张整体偏移量、设定可视编辑区域大小

          LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '100%'); //设置缩放
          // LODOP.PRINT_INIT('订单') //打印初始化
          LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
          LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
          LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
          // LODOP.SET_PRINT_STYLEA(0, "Horient", 2);
          LODOP.SET_PRINT_COPIES(this.printconfig2.printSum); //设置打印次数

          console.log("4B44F795076C8F14211A5ED0A5339305DAB")
          LODOP.SET_LICENSES("", "4B44F795076C8F14211A5ED0A5339305DAB", "23580B189D96F33252722697A57AC00506B", "");
          LODOP.SET_PRINT_COPIES(this.printconfig2.printSum);
          console.log(LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint));
          if (this.printconfig2.preview) {
            if (LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint)) {
              LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint);
              LODOP.PRINT();
              // LODOP.PRINT_DESIGN();
            } else {
              LODOP.SET_PRINTER_INDEXA(0);
              LODOP.PRINT();
              // LODOP.PRINT_DESIGN();
            }
          } else {
            if (LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint)) {
              LODOP.SET_PRINTER_INDEXA(this.printconfig2.defaultPrint);
              LODOP.PREVIEW();
              // LODOP.PRINT_DESIGN();
            } else {
              LODOP.SET_PRINTER_INDEXA(0);
              LODOP.PREVIEW();
              // LODOP.PRINT_DESIGN();
            }
          }
        }




        // if (LODOP.SET_PRINTER_INDEXA("打印机名"))  //根据打印机名字打印
        //   LODOP.PRINT();
        // 打印二维码
        // LODOP.ADD_PRINT_BARCODE(23,23,233,233,"QRCode","https://blog.csdn.net/qq_43652509");
        //打印网址
        // LODOP.ADD_PRINT_URL(222,2000,2000,233,"https://blog.csdn.net/qq_43652509");
        //打印图片
        // LODOP.ADD_PRINT_IMAGE(100,100,400,400,"<img border='0' src='http://s1.sinaimg.cn/middle/4fe4ba17hb5afe2caa990&690' width='345' height='250'>");
      },
      CreateOneFormPage2() {
        LODOP = getLodop();
        if (!LODOP) {
          this.$alert(
            `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
            '安装', {
              confirmButtonText: '确定',
              dangerouslyUseHTMLString: true
            }
          );
          return;
        }
        //样式
        var strStyleCSS = " <link href='https://ebooking.qlan99.com/css/print.css' type='text/css' rel='stylesheet'> ";

        var olstyle1 = '<!DOCTYPE html><html lang="zh-CN"><head>' + strStyleCSS + '</head>' + ' <style> ' +
          'div{border:0!important}' + '</style>';
        var body = '';
        if (this.printconfig.specs === '58mm') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t4.$refs.t4.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
        }
        if (this.printconfig.specs === '80mm') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t5.$refs.t5.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
        }
        if (this.printconfig.specs === 'A5') {
          var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig.printContentOffset)) +
            'mm !important}</style>';
          body = olstyle1 + olstyle2 + '<body>' + this.$refs.t6.$refs.t6.innerHTML + '</body>';
          LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
        }
        body += '</html>';
        LODOP.ADD_PRINT_HTM(0, this.printconfig.printPaperOffset, 1000, 2000, body); //增加超文本项
        // LODOP.PRINT_INITA(this.printconfig.printContentOffset, this.printconfig.printPaperOffset) //打印初始化、设定纸张整体偏移量、设定可视编辑区域大小
        LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '95%'); //设置缩放
        // LODOP.PRINT_INIT('订单') //打印初始化
        LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
        LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
        LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
        // LODOP.SET_PRINT_STYLEA(0, "Horient", 2);
        LODOP.SET_PRINT_COPIES(this.printconfig.printSum); //设置打印次数
        // if (LODOP.SET_PRINTER_INDEXA("打印机名"))  //根据打印机名字打印
        //   LODOP.PRINT();
        // 打印二维码
        // LODOP.ADD_PRINT_BARCODE(23,23,233,233,"QRCode","https://blog.csdn.net/qq_43652509");
        //打印网址
        // LODOP.ADD_PRINT_URL(222,2000,2000,233,"https://blog.csdn.net/qq_43652509");
        //打印图片
        // LODOP.ADD_PRINT_IMAGE(100,100,400,400,"<img border='0' src='http://s1.sinaimg.cn/middle/4fe4ba17hb5afe2caa990&690' width='345' height='250'>");
      },
      invoiceShow() {
        this.invoiceVisable = true;
        this.$nextTick(() => {
          this.$refs.invoice.init();
        });
      },
      chongzhangHandle() {
        this.chongzhangVisible = true
        this.$nextTick(() => {
          this.$refs.chongzhang.init(this.info.peopleEntity)
        });
      },
      getCZSum() {
        this.roomCostList = [], //产生的房费列表
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/getByTypeWithCZSum`),
            method: 'get',
            params: this.$http.adornParams({
              payType: 9,
              peopleId: this.info.peopleEntity.id
            })
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              this.CZSum = data.sum
            }
          });
      },
      comment(index) {
        alert(index)
      },
      ReadHY() {
        var M1ICCard = {
          "secNr": "8",
          "block": "0",
          "blockCount": "3"
        };
        var postData = {
          DeviceType: "MemberCardHareware",
          Params: JSON.stringify(M1ICCard)
        };
        return this.Post(postData, "Read");
      },
      handleCommand(index) {
        if (index == "1") {
          this.DoorCopyCard();
        } else if (index == "2") {
          this.DoorCancelCard();
        } else if (index == "3") {
          this.getDataListGate();
          this.showdetailsVisible = true;
        }
      },

      // 获取数据列表
      getDataListGate() {
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/hotel/tgatecard/list'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize,
            'sid': this.info.singleEntity.id,
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list
            this.totalPage = data.page.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle(val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataListGate()
      },
      // 当前页
      currentChangeHandle(val) {
        this.pageIndex = val
        this.getDataListGate()
      },


      getkk() {
        // methods["id"]=
        // console.log(methods)
        var result;
        this.$http({
          url: this.$http.adornUrl(`/hotel/business/Write`),
          method: 'post',
          data: this.$http.adornParams({
            id: this.roomId,
            singleId: this.info.singleEntity.id
          })
        }).then(({
          data
        }) => {
          this.doorLockParams.RoomNumber = data.roomNumber;
          this.doorLockParams.StartDate = data.StartDate;
          this.doorLockParams.EndDate = data.endDate;
          this.doorLockParams.CardID = data.CardID;
          this.doorLockParams.skr = data.skr;
          this.doorLockParams.sfz = data.sfz;
          this.doorLockParams.floorCengId = data.floorCengId
          this.doorLockParams.floorId = data.floorId
          this.doorLockParams.CardNum = data.CardNum;
          this.doorWriteCard(this.doorLockParams);
        });
      },
      savedataForm() {
        this.dataForm.skTime = this.doorLockParams.StartDate
        this.dataForm.zkUser = this.doorLockParams.skr
        this.dataForm.roomNum = this.doorLockParams.CardNum
        this.dataForm.kaNo = this.doorLockParams.RoomNumber
        this.dataForm.endTime = this.doorLockParams.EndDate
        this.dataForm.creatTime = this.doorLockParams.StartDate
        this.dataForm.floorCengId = this.doorLockParams.floorCengId
        this.dataForm.floorId = this.doorLockParams.floorId


        if (this.doorLockParams.OpeartorType == "NewCard") {
          this.dataForm.operation = "制新卡";
        } else if (this.doorLockParams.OpeartorType == "CopyCard") {
          this.dataForm.operation = "复制卡";
        } else {
          this.dataForm.operation = "注销卡";
        }
        this.$http({
          url: this.$http.adornUrl(`/hotel/tgatecard/save`),
          method: 'post',
          data: this.$http.adornData({
            'skTime': this.dataForm.skTime,
            'zkUser': this.dataForm.zkUser,
            'roomNum': this.dataForm.roomNum,
            'kaNo': this.dataForm.kaNo,
            'creatUserId': "",
            'endTime': this.dataForm.endTime,
            'ckSfz': this.dataForm.ckSfz,
            'operation': this.dataForm.operation,
            'creatTime': this.dataForm.creatTime,
            'floorCengId': this.dataForm.floorCengId,
            'floorId': this.dataForm.floorId
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

          } else {
            this.$message.error(data.msg)
          }
        })
      },
      /*
       * 读会员信息
       * 参数
       *   "secNr": "8"  //第几扇区
       *   "block": "0"  //第几块
       *   "blockCount": "3"//总块数
       */
      // ReadHY() {
      //   var postData = {
      //     DeviceType: "MemberCardHareware",
      //     Params: JSON.stringify(M1ICCard)
      //   };
      //   this.Post(postData, "Read");
      // },

      /*
       * 读门禁卡
       * 参数 可选
       * RoomNumber 房间号（门卡与房间关联的号）
       * StartDate 开始时间
       * EndDate 截止时间
       * OpeartorType 卡操作类型
       */
      DoorReadCard(doorLockParams) {
        var postData = {
          DeviceType: "DoorLockHareware",
          Params: JSON.stringify(doorLockParams)
        };
        this.Post(postData, "Read");
      },
      //制卡
      DoorNewCard() {
        this.doorLockParams.OpeartorType = "NewCard";
        this.getkk();


      },
      //复制卡
      DoorCopyCard() {
        this.doorLockParams.OpeartorType = "CopyCard";
        this.getkk();
      },

      //注销卡
      DoorCancelCard() {
        this.doorLockParams.OpeartorType = "CancelCard";
        this.getkk();
      },



      /*======================================================================*/
      /*
       * 写们禁卡
       * 参数 可选
       * RoomNumber 房间号（门卡与房间关联的号）
       * StartDate 开始时间
       * EndDate 截止时间
       * OpeartorType 卡操作类型
       */
      doorWriteCard(doorLockParams) {
        var postData = {
          DeviceType: "DoorLockHareware",
          Params: JSON.stringify(doorLockParams)
        };
        this.Post(postData, "Write");
      },

      Post(postData, methods) {
        console.log(postData)
        var result;
        this.istrues = 0;
        this.axios({
          url: this.axios.postUrl(`/api/Service/` + methods),
          method: 'POST',
          data: postData,
          cache: false,
          async: false,
          contentType: "application/json",
        }).then(({
          data
        }) => {
          if (data.isSuccess == true) {
            this.istrues = 1;
            this.$message({
              message: "操作成功",
              type: "success",
              duration: 1500
            });
            this.savedataForm();
          } else {
            this.istrues = 1;
            this.$message({
              message: data.message,
              type: "error",
              duration: 1500
            });
          }

        })



      },
      isputile(istrues, that) {
        setTimeout(function() {
          if (istrues == 0) {
            that.$message({
              message: "接口程序未打开，请打开接口程序",
              type: "error",
              duration: 1500
            });
          }
        }, 2000);

      },
      // this.$http({
      //     type: "POST",
      //     url: url + "/api/Service/" + methods,
      //     data: JSON.stringify(postData),
      //     cache: false,
      //      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
      //     async: false,
      //     changeOrigin:true,

      //     error: function (err) {
      //         alert(JSON.stringify(err));
      //     },
      //     success: function (data) {

      //     }
      // });

    },
    mounted() {
      this.$nextTick(() => {
        this.$emit('setPrintData', this.info, this.currData, this.priceMap);
      });

    }

  };
</script>

<style lang="scss">
  .el-popper {
    padding: 0;
  }

  .checkin_info_summary th {
    padding-top: 15px;
    color: #666;
    text-align: center;
  }

  // .checkin_info_summary tr th:last-of-type {
  //   border-top-right-radius: 4px;
  //   border-top-left-radius: 4px;
  //   background: #f24e4c;
  //   color: #fff;
  // }

  // .checkin_info_summary tr td:last-of-type {
  //   border-bottom-right-radius: 4px;
  //   border-bottom-left-radius: 4px;
  //   background: #f24e4c;
  //   color: #fff;
  // }

  .checkin_info_summary td {
    height: 48px;
    color: #151515;
    text-align: center;
  }

  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }

  .el-icon-arrow-down {
    font-size: 12px;
  }

  .is-aa {
    background: #fff !important;
    color: #333 !important;
  }

  .balance {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 4px;
    background: #f24e4c;
    color: #fff;
  }
</style>
